/*
 * @Author: greyqiu greyqiu@163.com
 * @Date: 2025-03-12 17:07:30
 * @LastEditors: greyqiu greyqiu@163.com
 * @LastEditTime: 2025-03-18 11:41:36
 * @Description: 
 * Copyright (c) 2025 by ${greyqiu}, All Rights Reserved. 
 */


#ifndef APP_COMM_COM_APP_H_
#define APP_COMM_COM_APP_H_

#include "mb_transport.h"

#define     COM_READ        3
#define     COM_WRITE       16
#define     WRITE_SINGLE    6

#define     ERR_READ        0x83
#define     ERR_WRITE       0x90

#define     ERRCODE_DEVICEADDR         0x01
#define     ERRCODE_FUNCODE            0x02
#define     ERRCODE_DATAADDR           0x04
#define     ERRCODE_DATALEN            0x08
#define     ERRCODE_CRC                0x10
#define     ERRCODE_RAMOVER            0x40
#define     ERRCODE_ADDRNORANGE        0x80

#define DSP_ADDR    0x08

extern MstObj ModBusCom;

void COM_appInit(void);
void COM_appTskRun(void);
void mbReadHoldReg(uint16_t slvId, uint16_t addr, uint16_t num);
void mbTimeInc(void);

#endif /* APP_COMM_COM_APP_H_ */
